"""organization models"""
from django.contrib.auth.models import AbstractUser
from django.db import models

from .base import TimeModel



class User(AbstractUser, TimeModel):
    email = models.EmailField(unique=True, null=True, default=None, help_text='用户绑定邮箱')
    username = models.CharField(max_length=64, unique=True, help_text='gitcode登录用户名')
    gitcode_name = models.CharField(max_length=64, help_text='gitcode昵称')
    gitcode_id = models.CharField(max_length=32, unique=True, help_text='gitcode用户唯一id（uuid）')


    def __str__(self):
        return self.username


    class Meta:
        db_table = 'organization_user'
        swappable = 'AUTH_USER_MODEL'


class Company(TimeModel):
    name = models.CharField(max_length=128, unique=True, help_text='公司名')

    def __str__(self):
        return self.name

    class Meta:
        db_table = 'organization_company'
